//
//  XSQLoginVC.m
//  BuDeJie
//
//  Created by Sem on 2018/6/29.
//  Copyright © 2018年 SEM. All rights reserved.
//

#import "XSQLoginVC.h"
#import "XSQLoginAndReView.h"
@interface XSQLoginVC ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *leftConstraint;
@property (weak, nonatomic) IBOutlet UIView *middleView;

@end

@implementation XSQLoginVC
- (IBAction)backClick:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (IBAction)lrClick:(UIButton *)sender {
    sender.selected=!sender.selected;
    self.leftConstraint.constant = self.leftConstraint.constant==0?-self.middleView.xmg_width*0.5:0;
    [UIView animateWithDuration:1 animations:^{
        [self.view layoutIfNeeded];
    }];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupLoginAndReView];
    // Do any additional setup after loading the view.
}
-(void)setupLoginAndReView{
    XSQLoginAndReView *logginView = [XSQLoginAndReView loginView];
    XSQLoginAndReView *registView = [XSQLoginAndReView registView];
    
    [self.middleView addSubview:logginView];
    [self.middleView addSubview:registView];
}
- (void)viewDidLayoutSubviews{
    [super viewDidLayoutSubviews];
    self.middleView.subviews[0].frame=CGRectMake(0, 0, self.middleView.xmg_width*0.5, self.middleView.xmg_height);
    self.middleView.subviews[1].frame=CGRectMake(self.middleView.xmg_width*0.5, 0, self.middleView.xmg_width*0.5, self.middleView.xmg_height);
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
